<?php
 /**********************************************************************\
** ztListDir                                                            **
** Listet den Inhalt eines Verzeichnisses parametergesteuert auf        **
**                                                                      **
** Version 1.2                                                          **
** 20. Dezember 2002                                                    **
** Version 1.3                                                          **
** 09. May 2005                                                         **
** Version 1.4                                                          **
** 29. March 2007                                                       **
**                                                                      **
** Copyright (c) by Zeljko Trulec                                       **
** info@zeltru-design.de                                                **
** http://www.Zeltru-Design.de                                          **
**                                                                      **
** ==================================================================== **
** This program is free software. You can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation; either version 2 of the License.       **
 \**********************************************************************/

 /**********************************************************************\
** READ ME :                                                            **
**          + Just copy this file in any directory you wanna            **
**            shown as root-directory (with the subs in it)!            **
**          + Rename htaccess.txt to .htaccess                          **
**          + Maybe you want to change some parameters in listdir.php   **
**          + Enjoy the directory-listing!                              **
**                                                                      **
 \**********************************************************************/

global $self_path;
$self_path = str_replace( "\\", "/", dirname(__file__) );
$err_msg = false;
$inc = false;
$doit = true;
while($doit === true) {
  if ( ($self_path == $_SERVER["DOCUMENT_ROOT"]) && (!file_exists($self_path . "/listdir.php")) ) {
    $err_msg = "ERROR: Mainfile not found!";
    $doit = false;
  }
  elseif (file_exists($self_path . "/listdir.php")) {
    $inc = $self_path . "/listdir.php";
    $doit = false;
  }
  else {
    $self_path = str_replace( "\\", "/", dirname($self_path) );
  }
}
if ($err_msg === false) include $inc;
else echo $err_msg;
?>